#ifndef COMMANDPARSER_H
#define COMMANDPARSER_H

#include <QObject>
#include "clientsocket.h"
#include "../database_plugins/idatabase.h"

class CommandParser : public QObject
{
    Q_OBJECT
private:
	QByteArray m_okBlock;
	QByteArray m_failBlock;
	QByteArray m_loginBlock;
public:
    explicit CommandParser(QObject *parent = 0);

signals:

private slots:
	void logMeIn(ClientSocket* socket, QByteArray &data);

	void addLogin(ClientSocket* socket, QByteArray &data);
	void changePassword(ClientSocket* socket, QByteArray &data);
	void getChannels(ClientSocket* socket, QByteArray &data);
	void getNews(ClientSocket* socket, QByteArray &data);
	void addChannel(ClientSocket* socket, QByteArray &data);
	void updateNews(ClientSocket* socket, QByteArray &data);

	void sendChannel(ClientSocket* socket, const ChannelEntry &entry);
	void sendNews(ClientSocket* socket, const NewsEntry &entry);



public slots:
	void decodeData(ClientSocket* socket, QByteArray data);
};

#endif // COMMANDPARSER_H
